package cn.school.student.common.enumdir;

import lombok.Getter;

@Getter
public enum GenderEnum {

    man("男","1"),
    woman("女","0");

    GenderEnum(String label,String value){
        this.label=label;
        this.value=value;
    }

    private String label;

    private String value;

    //通过label获取对应的枚举实例
    public static GenderEnum getByLabel(String name) {
        GenderEnum [] list = values();
        for (GenderEnum genderEnum : list) {
            if ((genderEnum.label).equals(name)) {
                return genderEnum;
            }
        }
        return null;
    }

}
